package com.brave.banner.controller;

import com.brave.banner.dto.FindBannerByTypeDTO;
import com.brave.banner.service.BannerQueryService;
import com.brave.base.BaseController;
import com.brave.base.RedisKit;
import com.brave.user.dto.RedisUserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "Banner部分", tags = "Banner部分", description = "Banner部分")
@RestController
@RequestMapping("/v1/banner")
public class BannerQueryController extends BaseController
{
    @Autowired
    private RedisKit redisKit;
    @Autowired
    private BannerQueryService bannerQueryService;
    
    
    
    @ApiOperation(value = "查询对应的Banner信息")
    @ApiImplicitParam(name = "dto", value = "查询参数", required = true, dataType = "FindBannerByTypeDTO")
    @PostMapping(value = "/findBannerByType", produces = "application/json")
    public String findBannerByType(@RequestHeader String token, @RequestBody FindBannerByTypeDTO dto)
    {
        //校验身份
        RedisUserInfo redisUserInfo = redisKit.checkUserToken(token);
        if(null == redisUserInfo)
        {
            return tokenBadRequest();
        }
        //调用业务逻辑
        return bannerQueryService.findBannerByType(dto);
    }
    
    
    
    
    
    
    
    
    
    
    
    
}